// *************************************************************************************************
//
// MK3D Engine
// --------------------------------------
// Copyright (C) 2007-2011 Zeb (mailto: zebbey@gmail.com)
//
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//
// *************************************************************************************************

#include "mk_header.h"
#include "mk_ui_appearence.h"

namespace MK3DE
{
    CUIWindowAppearence::CUIWindowAppearence() : _currentLook(-1)
    {

    }

    CUIWindowAppearence::~CUIWindowAppearence()
    {

    }

    void CUIWindowAppearence::Clear()
    {
        _vecLook.clear();
        _currentLook = -1;
    }

    void CUIWindowAppearence::AddLook()
    {
        LOOK_TYPE look;
        _vecLook.push_back(look);
        _currentLook = (int)_vecLook.size() - 1;
    }

    void CUIWindowAppearence::SetCurrentLook(int idx)
    {
        if (idx >=0 && idx < (int)_vecLook.size())
            _currentLook = idx;
    }

    void CUIWindowAppearence::AddQuad(SUIQuad& quad)
    {
        if (_currentLook == -1)
            return;

        LOOK_TYPE& look = _vecLook[_currentLook];
        look.push_back(quad);
    }

    BOOL CUIWindowAppearence::GetNextQuad(SUIQuad*& quad, int& index)
    {
        if (_currentLook == -1)
            return FALSE;

        if (index < 0)
            index = 0;

        LOOK_TYPE& look = _vecLook[_currentLook];
        if (index >= 0 && index < (int)look.size())
        {
            quad = &look[index];
            index++;
            return TRUE;
        }

        return FALSE;
    }
}